package com.larry.design.creatation.builder;

import org.junit.Test;

/**
 * @author larry
 * @Title: design-frame
 * @Package com.larry.design.creatation.builder
 * @Description: 建造者模式
 * @date 8/31/2110:46 PM
 */
public class BuilderTest {

    @Test
    public void test(){
        AbstractBuilder builder = new IphoneBuilder();
        //builder.customCpu("A14");
        //builder.customCamera("1200W");
        //builder.customDisk("256G");
        //builder.customMem("16G");


        //链式调用
        builder.customMem("16G").customDisk("256G").customCamera("5000W").customCpu("A15");

        Phone phone = builder.getProduct();
        System.out.println(phone);


        Phone phone1 = Phone.builder().camera("a").cpu("b").disk("c").mem("d").build();
        System.out.println(phone1);
    }

}
